package com.ef.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.ef.constant.EGenderType;
import com.ef.constant.ENationalType;
import com.ef.constant.StatusType;

@Entity
public class Teacher implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@Column(length = 100)
	private String name;

	@Column(length = 100)
	private String telephone;
	
	@Column(length = 100)
	private String email;

	@Column(length = 300)
	private String address;

	@Temporal(TemporalType.TIMESTAMP)
	private Date availablityDate;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date resignationDate;
	
	@Enumerated(value = EnumType.STRING)
	private ENationalType nationality;
	
	@Enumerated(value = EnumType.STRING)
	private EGenderType gender;

	@Temporal(TemporalType.DATE)
	private Date startDate;

	@Temporal(TemporalType.DATE)
	private Date endDate;
	
	/**
	 * 用于排序
	 */
	private Integer turnOrder ;
	
	private Boolean foreign;
	
	private Boolean client;
	
	@ManyToOne(fetch = FetchType.LAZY)
	private User updateUser;

	@Temporal(TemporalType.TIMESTAMP)
	private Date updateTime;
	
	@Enumerated(value = EnumType.STRING)
	private StatusType status = StatusType.VALID;

	@ManyToOne(fetch = FetchType.EAGER)
	private School school;
	
	
	public StatusType getStatus() {
		return status;
	}

	public void setStatus(StatusType status) {
		this.status = status;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	 

	public Date getAvailablityDate() {
		return availablityDate;
	}

	public void setAvailablityDate(Date availablityDate) {
		this.availablityDate = availablityDate;
	}

	public Date getResignationDate() {
		return resignationDate;
	}

	public void setResignationDate(Date resignationDate) {
		this.resignationDate = resignationDate;
	}

	public ENationalType getNationality() {
		return nationality;
	}

	public void setNationality(ENationalType nationality) {
		this.nationality = nationality;
	}

	public EGenderType getGender() {
		return gender;
	}

	public void setGender(EGenderType gender) {
		this.gender = gender;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public boolean isForeign() {
		if (foreign==null){
			return false;
		}
		return foreign;
	}

	public void setForeign(boolean foreign) {
		this.foreign = foreign;
	}

	public boolean isClient() {
		return client;
	}

	public void setClient(boolean client) {
		this.client = client;
	}

	public Integer getTurnOrder() {
		return turnOrder;
	}

	public void setTurnOrder(Integer turnOrder) {
		this.turnOrder = turnOrder;
	}

	public User getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(User updateUser) {
		this.updateUser = updateUser;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public School getSchool() {
		return school;
	}

	public void setSchool(School school) {
		this.school = school;
	}

}
